Skip to content

Conversation

@A-006
Copy link
Collaborator

@A-006 A-006 commented Jan 14, 2026

Overview

This PR refactors multiple physics and IO modules to replace direct MPI_Allreduce calls (particularly those using MPI_IN_PLACE) with the encapsulated templated API in Parallel_Reduce. This improves code consistency across the repository and ensures that MPI operations are handled through a unified interface.

Key Changes

Benefits

  • Better Abstraction: Centralizes parallel reduction logic, making the code cleaner and easier to maintain.
  • Safety: Utilizes the library's internal status checks for MPI initialization, preventing potential crashes in serial/uninitialized environments.
  • Consistency: Aligning various modules with the standard ABACUS parallel communication pattern.

@A-006 A-006 marked this pull request as draft January 14, 2026 12:01
@A-006 A-006 marked this pull request as ready for review January 14, 2026 14:40
return;
}

void Parallel_Reduce::reduce_or_bp(bool& object)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the meaning of 'or'?

#ifdef __MPI
MPI_Allreduce(MPI_IN_PLACE, ibox, 3, MPI_INT, MPI_MAX , this->pool_world);
Parallel_Reduce::reduce_max_pool(ibox, 3);
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete the #ifdef __MPI and #endif ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants